home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / amigaoscd / amigapluscd / AP-Website / links / admin / unrelated.php < prev    next >
PHP Script  |  2001-07-26  |  2KB  |  107 lines

  1. <?
  2. // *******************************************************************
  3. //  admin/unrelated.php
  4. // *******************************************************************
  5.  
  6. include("../include/config.php");
  7. include("../include/functions.php");
  8.  
  9. include("../include/common.php");
  10. $language = $gl["Language"];
  11.  
  12. include("../include/lang/$language.php");
  13.  
  14. include("../include/session.php");
  15. session_start();
  16. ?>
  17. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  18. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  19. <html>
  20. <head>
  21. <title></title>
  22. <link rel = "stylesheet" type = "text/css" href = "style.css" />
  23. </head>
  24. <?=$adm_body?>
  25. <table cellspacing="0" cellpadding="5" border="1" align="center" width="100%">
  26. <?
  27.     $query = sql_query("
  28.         select
  29.             $tb_categories.ID as cat_id
  30.         from
  31.             $tb_categories
  32.         left join
  33.             $tb_related
  34.         on
  35.             $tb_categories.ID=$tb_related.cat_id
  36.         where
  37.             $tb_related.cat_id is null
  38.         and
  39.             $tb_categories.PID != '0'
  40.         order by
  41.             $tb_categories.ID
  42.     ");
  43.  
  44.     if(sql_num_rows($query)>0){
  45.         
  46.         ?><tr><td class="theader">Unrelated Categories</td></tr><?
  47.         
  48.         while($rows = sql_fetch_array($query)){
  49.  
  50.             echo "<tr><td><a href=\"related_main.php?" . session_name() . "=";
  51.             echo session_id() . "&submit=1&list=1&Category=";
  52.             echo $rows[cat_id] . "\">";
  53.             
  54.             unset($gcid);
  55.             
  56.             if(isset($rows[cat_id])){
  57.                 
  58.                 $gcid = $rows[cat_id];
  59.             }
  60.  
  61.             while($gcid > 0){
  62.                 
  63.                 $mlc_sql = "
  64.                     select
  65.                         *
  66.                     from
  67.                         $tb_categories
  68.                     where
  69.                         ID = '$gcid'
  70.                 ";
  71.  
  72.                 $mlc_query = sql_query($mlc_sql);
  73.                 $mlc_array = sql_fetch_array($mlc_query);
  74.                 
  75.                 $cat_array[] = $mlc_array["Category"];
  76.                 $pid_array[] = $mlc_array["ID"];
  77.                 $gcid = $mlc_array["PID"];
  78.             }
  79.  
  80.             $count = sizeof($pid_array);
  81.  
  82.             for($depth=$count;$depth>=0;$depth--){    
  83.                 
  84.                 if($pid_array[$depth]){
  85.                     
  86.                     echo " >> " . ereg_replace("_"," ",($cat_array[$depth]));
  87.                     
  88.                     if($gcid > 0){
  89.                         
  90.                         echo "  ";
  91.                     }
  92.                 }
  93.             }
  94.  
  95.             unset($pid_array);
  96.             unset($cat_array);
  97.             
  98.             echo "</a></td></tr>";
  99.         }
  100.     } else {
  101.         ?><tr><td class="theader">No Unrelated Categories found.</td></tr><?
  102.     }
  103. ?>
  104. </table>
  105. </body>
  106. </html>
  107.